<template>
	<view class="content">
		<button type="default" @click="test('timing', 'fund/uplateLine')">更新K线</button>
		<button type="default" @click="test('capture', 'stock/fetchStockBaseInfoList')">capture</button>
		<!-- <button type="default" @click="test('stock', 'common/getBaseInfoListWithStock',{long:'long'})">sotck 测试</button> -->
		<button type="default" @click="test('stock', 'line/clearRepeatLineForDay')">clearRepeatLineForDay; 测试</button>
		<button type="default" @click="test('stock', 'common/updateStockInfoToDiff')">sotckCommon 测试</button>
		<button type="default" @click="test('stock', 'common/addIterWithStock')">sotckCommon addIterWithStock 测试</button>
		<button type="default" @click="test('market', 'common/getMarketIsCloseWithA')">market 测试</button>
		<button type="default" @click="test('dictionary', 'common/updateIterPopDateByType')">dictionary 测试</button>
		<button type="default" @click="test('capture', 'timing/removeLogTimingListAll')">删除所有timing日志</button>
		<!-- <input type="text" v-model="inputValue" /> -->
		<!-- <button type="default" @click="test('capture', 'fund/addFundBaseList')">新增基金基本信息列表</button>
		<button type="default" @click="test('capture', 'fund/updateFundBaseList')">更新基金基本信息列表</button>
		<button type="default" @click="test('capture', 'fund/updateFundSymbolList')">更新基金symbol列表集合</button>
		<button type="default" @click="test('capture', 'timing/removeLogTimingListAll')">删除所有timing日志</button>
		<button type="default" @click="test('captu', 'timing/ping')">测试</button>
		<!-- <button type="default" @click="test('capture', 'fund/removeFundBaseList')">删除所有基金基础信息</button> -->
		<!-- <button type="default" @click="test('timing2')">测试2</button> -->
		<!-- <button type="default" @click="test('capture','stock/removeAllKLine')">删除所有日线数据</button>
		<button type="default" @click="test('capture','stock/addStockLines')">插入股票日线</button> -->
		<!-- <button type="default" @click="test('stock','common/removeAllStockBaseList')">删除股票基本信息列表</button>
		<button type="default" @click="test('capture','stock/addStockBaseInfoList')">插入股票基本数据</button>
		<button type="default" @click="test('fund','common/searchFundBaseInfo', inputValue)">查询基金</button>
		<button type="default" @click="test('test','utils/readFile')">测试</button>
		<button type="default" @click="test2()">测试正则</button> -->
	</view>
</template>

<script>
export default {
	data() {
		return {
			inputValue: ''
		};
	},
	onLoad() {},
	methods: {
		test2() {
			// const input = `jQuery1124020589748748853132_1622518815104({"rc":0,"rt":6,"svr":182996227,"lt":1,"full":1,"data":{"total":4496,"diff":[{"f1":2,"f2":63.31,"f3":73.69,"f4":26.86,"f5":47775,"f6":309944432.0,"f7":14.54,"f8":33.45,"f9":46.8,"f10":"-","f11":-0.61,"f12":"301005","f13":0,"f14":"N超捷","f15":68.5,"f16":63.2,"f17":68.0,"f18":36.45,"f20":3616704229,"f21":904176073,"f22":-0.3,"f23":4.87,"f24":73.69,"f25":73.69,"f62":83871612.0,"f115":40.63,"f128":"-","f140":"-","f141":"-","f136":"-","f152":2}]}});`
			const input = `jQuery11240010617368380730463_1622536999552({"rc":102,"rt":1,"svr":181214692,"lt":1,"full":1,"data":null});`;
			const regexp = new RegExp(`.*"data":(.*)\\}\\);`, 'gi');
			const repInput = input.replace(regexp, `{"data":$1}`);
			console.log(repInput);
			console.log(JSON.parse(repInput.trim()));
		},
		test(name, action, data) {
			uni.showLoading({
				title: '加载中...'
			});
			uniCloud
				.callFunction({
					name,
					data: {
						action,
						data
					},
				})
				.then(res => {
					console.log(res);
				})
				.catch(err => {
					uni.showModal({
						content: err.message || '请求服务失败',
						showCancel: false
					});
					console.log(err);
				})
				.finally(() => {
					uni.hideLoading({});
				});
		}
	}
};
</script>

<style>
button {
	margin-top: 1em;
	width: 100%;
}
</style>
